﻿using ComicReader.Controllers;

namespace ComicReader
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow
    {
        readonly MainWindowController Controller;



        public MainWindow()
        {
            InitializeComponent();

            Controller = new MainWindowController(this);

        }

        private void CommandBinding_CanExecuteOpenArchive(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e)
        {
            if (Controller != null) e.CanExecute = Controller.CanOpenArchive;
        }

        private void CommandBinding_ExecutedOpenArchive(object sender, System.Windows.Input.ExecutedRoutedEventArgs e)
        {
            if (Controller != null) Controller.OpenArchive();
        }

        private void CommandBinding_CanExecuteConvertDirectory(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e)
        {
            if (Controller != null) e.CanExecute = Controller.CanConvertDirectory;
        }

        private void CommandBinding_ExecutedConvertDirectory(object sender, System.Windows.Input.ExecutedRoutedEventArgs e)
        {
            if (Controller != null) Controller.ConvertDirectory();
        }
    }
}
